import request from '@/utils/request'

var baseUrl = '/customer'

export function login(data) {
    return request({
        url: baseUrl + '/login',
        method: 'post',
        data
    })
}
export function save(data) {
    return request({
        url: baseUrl + '/save',
        method: 'post',
        data
    })
}

export function getUserInfo() {
    return request({
        url: baseUrl + '/get-user-info',
        method: 'get',
        params:{}
    })
}

export function changePassword(data) {
    return request({
        url: baseUrl + '/change_password',
        method: 'post',
        data
    })
}

export function changePasswordByEmailCheck(data) {
    return request({
        url: baseUrl + '/change-password-by-email-check',
        method: 'post',
        data
    })
}

export function getResetCode(userName,email) {
    return request({
        url: baseUrl + '/get-reset-code-by-email',
        method: 'get',
        params: { userName:userName,email:email }
    })
}

export function getById(id) {
    return request({
        url: baseUrl + '/get-by-id',
        method: 'get',
        params: { id }
    })
}

export function fetchList(query) {
    return request({
        url: baseUrl + '/get-list-page',
        method: 'post',
        data: query
    })
}

export function createCustomer(data) {
    return request({
        url: baseUrl + '/save',
        method: 'post',
        data
    })
}

export function updateCustomer(data) {
    return request({
        url: baseUrl + '/update',
        method: 'post',
        data
    })
}

export function deleteOneCustomer(id) {
    return request({
        url: baseUrl + '/delete-one',
        method: 'get',
        params: { id }
    })
}
export function getVipListJson() {
    return request({
        url: '/vip/get-list-json',
        method: 'get',
        params: {}
    })
}
